<template>
	<div class="Info-show">
		<div class="Info-show-warpper">
			<div class="info-table">
				<info-table 
					ref="info-table"
					:thead="thead" 
					:tbody="tbody"
					:total="total"></info-table>
			</div>
		</div>
		
		<loading v-show="showLoading"></loading>
	</div>
</template>

<script>
	import { loadingMixin, infoTableMixin } from 'common/js/mixins';
	import { SystemDocumentThead } from 'common/js/table';
	import { errorNotice } from 'common/js/dom';
	import { httpUrl} from 'api/config';
	import { getSystemDocument } from 'api/Main';
	
	export default {
		mixins: [loadingMixin, infoTableMixin],
		created() {
			this._getList();
		},
		data() {
			return {
				thead: SystemDocumentThead(this),
				tbody: [],
				total: 0,
				showLoading: false
			}
		},
		methods: {
			down(row) {
				window.open(`${httpUrl}${row.filePath}`, '_blank');
			},
			_getList(page) {
				this.showLoading = true;
				getSystemDocument(page)
					.then(res => {
						this.tbody = res.rows;
						this.total = res.total;
						this.showLoading = false;
					}).catch(res => {
						this.showLoading = false;
						errorNotice(res.message);
					})
			}
		}
	}
</script>

<style>
	
</style>